<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for components\calendar\dx-calendar.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(../../sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="../../index.html">all files</a> / <a href="index.html">components/calendar/</a> dx-calendar.vue
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/26</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/9</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/1</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/26</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
	&lt;!-- 两列排列 --&gt;
    &lt;div class="dx-calendar"&gt;
    	&lt;div class="dx-calendar__select"&gt;
    		&lt;span 
                @click="preYear()"
            &gt;
                &lt;i class="icon iconfont dx-arrow-left-double"&gt;&lt;/i&gt;
            &lt;/span&gt;
            &lt;span 
                class="dx-calendar__select--left"
                @click="preMonth()"
            &gt; &lt;i class="icon iconfont dx-prev"&gt;&lt;/i&gt; &lt;/span&gt;
            &lt;span class="dx-calendar__select--input"&gt;
                &lt;input 
                    v-model="year"
                    readonly="readonly" 
                /&gt;
                &lt;input 
                    v-model="month"
                    readonly="readonly" 
                /&gt;
            &lt;/span&gt;
           
            &lt;span 
                class="dx-calendar__select--right"
                 @click="nextMonth()"
            &gt; &lt;i class="icon iconfont dx-next"&gt;&lt;/i&gt; &lt;/span&gt;
           &lt;span 
                class="dx-calendar__select--right"
                 @click="nextYear()"
            &gt; &lt;i class="icon iconfont dx-arrow-right-double"&gt;&lt;/i&gt; &lt;/span&gt;
    	&lt;/div&gt;
    	&lt;div&gt;
    		&lt;table class="dx-calendar__content-table" width="100%"&gt;
                &lt;thead&gt;
                    &lt;th v-for="weekDay in weekDays"&gt;{{weekDay}}&lt;/th&gt;
                &lt;/thead&gt;
                &lt;tbody&gt;
                    &lt;tr class="dx-calendar__content-table--blanking"&gt;&lt;/tr&gt;
                    &lt;tr 
                        v-for="row in rows"
                        :key="row"
                    &gt;
                        &lt;td 
                            v-for="column in 7"
                            :key="column"
                            :class="{
                                    'is-today': today(row, column), 
                                     'is-curent-month': isCurrentMonth(row, column)}"
                            class="dx-calendar__content-table--td"
                        &gt;
                            &lt;slot
                                :date="store[(row - 1) * 7 + column - 1]" 
                                :today="dateStore.day"&gt; 
                                {{ store[(row - 1) * 7 + column - 1] }}
                            &lt;/slot&gt;
                        &lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/tbody&gt;      
            &lt;/table&gt;
    	&lt;/div&gt;
    &lt;/div&gt;
&lt;/template&gt;
&lt;script&gt;
    import DateStore from './dateStore.js'
	export default {
		name: 'DxCalendar',
		componentName: 'DxCalendar',
        props: {
            size: {
                type: Number,
                default: 42,
                validator: function(value) <span class="fstat-no" title="function not covered" >{</span>
<span class="cstat-no" title="statement not covered" >                    return value &gt;= 35</span>
                }
            },
            currentMonth: Boolean
        },
        data() {
            const dateStore = <span class="cstat-no" title="statement not covered" >new DateStore({</span>
                    size: this.size,
                    currentMonth: this.currentMonth
                })
<span class="cstat-no" title="statement not covered" >            return {</span>
                weekDays: ['日', '一', '二', '三', '四', '五', '六'],
                dateStore
            }
        },
        computed: {
            store() {
<span class="cstat-no" title="statement not covered" >                return this.dateStore.store</span>
            },
            year() {
<span class="cstat-no" title="statement not covered" >                return `${this.dateStore.year}年`</span>
            },
            month() {
<span class="cstat-no" title="statement not covered" >                return `${this.dateStore.month + 1}月`</span>
            },
            rows() {
<span class="cstat-no" title="statement not covered" >                return Math.floor(this.size / 7)</span>
            }
        },
        methods: {
            // 这里month 范围 0-11
            preMonth() {
                let month = <span class="cstat-no" title="statement not covered" >this.dateStore.month</span>
<span class="cstat-no" title="statement not covered" >                month = month &lt; 1 ? 11 : month - 1</span>
<span class="cstat-no" title="statement not covered" >                this.dateStore.setMonth(month)</span>
<span class="cstat-no" title="statement not covered" >                this.$emit('month-change', month)</span>
            },
            nextMonth() {
                let month = <span class="cstat-no" title="statement not covered" >this.dateStore.month</span>
<span class="cstat-no" title="statement not covered" >                month = month &gt; 10 ? 0 : month + 1</span>
<span class="cstat-no" title="statement not covered" >                this.dateStore.setMonth(month)</span>
<span class="cstat-no" title="statement not covered" >                this.$emit('month-change', month)</span>
            },
            // 这里month 范围 0-11
            preYear() {
                let year = <span class="cstat-no" title="statement not covered" >this.dateStore.year</span>
<span class="cstat-no" title="statement not covered" >                this.dateStore.setYear(year-1)</span>
<span class="cstat-no" title="statement not covered" >                this.$emit('year-change', year-1)</span>
            },
            nextYear() {
                let year = <span class="cstat-no" title="statement not covered" >this.dateStore.year</span>
<span class="cstat-no" title="statement not covered" >                this.dateStore.setYear(year+1)</span>
<span class="cstat-no" title="statement not covered" >                this.$emit('year-change', year+1)</span>
            },
            today(row, column) {
                let index = <span class="cstat-no" title="statement not covered" >(row - 1) * 7 + column - 1</span>
                let dayNum = <span class="cstat-no" title="statement not covered" >this.store[index]</span>
<span class="cstat-no" title="statement not covered" >                return index &gt;= this.dateStore.startInd &amp;&amp;</span>
                        index &lt;= this.dateStore.endInd &amp;&amp;
                        dayNum === this.dateStore.day
            },
            isCurrentMonth(row, column) {
                let index = <span class="cstat-no" title="statement not covered" >(row - 1) * 7 + column - 1</span>
<span class="cstat-no" title="statement not covered" >                return index &gt;= this.dateStore.startInd &amp;&amp; index &lt;= this.dateStore.endInd</span>
            }
        }
	}
&lt;/script&gt;
&lt;style lang="scss"&gt;
    @include B(calendar) {
        width: 100%;
        margin-top: 0.3rem;
        font-size: 1.3rem;
        /* 日期输入框 */
        @include E(select) {
            padding: 0 0.4rem;
            margin-bottom: 0.51rem;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: space-around;
            @include M(left) {
                background-size: 100% 100%;
                width: $--dx-calendar-icon-width;
                height: $--dx-calendar-icon-height;
            }
            @include M(right) {
                background-size: 100% 100%;
                width: $--dx-calendar-icon-width;
                height: $--dx-calendar-icon-height;
            }
            @include M(input) {
                &amp;&gt;input {
                    display: inline-block;
                    max-width: 5rem;
                    text-align: center;
                    border: none;
                    font-size: 1.3rem; 
                }
            }
            &amp;&gt;span {
                color: $--dx-calendar-icon-color;
                &amp;:first-child {
                    margin-right: 2rem;
                }
                &amp;:last-child {
                    margin-left: 2rem;
                }
            }
        }
        /* 日历显示表格 */
        @include E(content-table) {
            width: 100%;
            border-collapse: collapse;
            &gt;thead {
                border-radius: 50%;
                border-bottom: 1px solid #ccc;
                margin-bottom: 0.63rem;
                &gt;th {
                    font-weight: normal;
                    font-size: $--dx-calendar-th-font-size;
                    padding: 1rem 0;
                    }
            }
            @include M(blanking) {
                height: 0.63rem;
            }
            @include M(td) {
                height: 0.63rem;
                text-align: center;
                color: $--dx-calendar-td-color;
                font-size: $--dx-calendar-td-font-size;
                margin: 1rem auto;
                padding: 1rem; 
                @include when(curent-month) {
                   color: $--dx-calendar-td-color-month;
                }
                @include when(is-today) {
                    background-color: $--dx-calendar-td-bacckground-color-today;
                    border-radius: 50%;
                }
            }
        }
    }
&lt;/style&gt;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 15:08:50 GMT+0800 (中国标准时间)
</div>
</div>
<script src="../../prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="../../sorter.js"></script>
</body>
</html>
